Attribute VB_Name = "modOutCommands"
Public Sub processOutCommand(ByVal user As String, ByVal text As String)
  If Left(text, Len(trigger)) <> trigger Then Exit Sub
  If Len(text) <= Len(trigger) Then Exit Sub

  Dim a As Integer, r As String

  GetDBEntry user, a, r
  If a = -1 And r = vbNullString Then Exit Sub

  cmd = Split(Mid(Trim(text), Len(trigger) + 1), " ")
  ucmd = UBound(cmd)
  
  Select Case cmd(0)
    Case "whoami", "me"
                    If r = vbNullString Then
                      AddChat vbCyan, user, vbWhite, ", You have " & a & " Access"
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                      
                      AddQ user & ", You have " & a & " Access"
                    ElseIf a = -1 Then
                      AddChat vbCyan, user, vbWhite, ", You have Rank: " & r
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                      
                      AddQ user & ", You have Rank: " & r
                    Else
                      AddChat vbCyan, user, vbWhite, ", You have " & a & " Access " & "| Rank: " & r
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                      
                      AddQ user & ", You have " & a & " Access " & "| Rank: " & r
                    End If
                    
   Case "quit"
                    If a >= 100 Then
                      AddChat vbWhite, "Shutting down VectorNet Bot."
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                      
                      AddQ "Shutting down VectorNet Bot!"
                      frmChat.sckVectorNet.Close
                      Unload frmChat
                    End If
                    
   Case "home"
                    If a >= 50 Then
                      If LCase(currentChannel) = "main" Then Exit Sub
                        If frmConfig.txtHome.text <> vbNullString Then
                            sendPacket &HC, username & Chr$(0) & frmConfig.txtHome
                        Else
                            AddChat vbRed, "No home channel set.. Joining Default VectorNet Channel!"
                            frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                            
                            sendPacket &HC, username & Chr$(0) & "Main"
                       End If
                    End If
                    
   Case "say"
                    If ucmd = 0 Then Exit Sub
                    If a >= 50 Then
                      sayMessage = Split(text, cmd(O) & " ")(1)
                      sendPacket &H2, username & Chr$(O) & sayMessage
                      AddChat vbCyan, "<" & frmConfig.txtUsername.text & "> ", vbGreen, "(Bot Command: Say) ", vbWhite, sayMessage
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                    End If
                    
   Case "v", "version", "ver"
                
                    ver = "Using :: VectorNet Bot v2.4 by Plugins ::"
                
                      AddChat vbWhite, ver
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                      
                      sendPacket &H2, username & Chr$(0) & ver
                      
   Case "page"
                    If a >= 50 Then
                    
                      pagemsg = "Sending Page Notification to: " & username
                    
                      AddChat vbTeal, "<", vbOrange, username, vbTeal, "> ", vbWhite, pagemsg
                      sendPacket &H2, username & Chr$(0) & pagemsg
                      
                        
                      Dim i As Long
                       For i = 200 To 600 Step 10
                          BeepAPI i, 50
                       Next
                    End If
                    
   Case "cmds"
   
                    Dim cmdwhoami As String
                    Dim cmdsay As String
                    Dim cmdjoin As String
                    Dim ymu As String
                    Dim allcmds As String
                      
                    ymu = "You may use the following commands: "
                    allcmds = "All commands are enabled to your access level."
                    ownerofbot = "You are an owner of this bot, you have access to everything."
                    cmdwhoami = "whoami"
                    cmdsay = "say"
                    cmdjoin = "join"
                      
                    If a < 1 Then
                      AddChat vbGray, "-- Bot Command: ", vbGreen, cmdwhoami
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                      
                      sendPacket &H2, username & Chr$(0) & "50 Access: " & cmdwhoami
                    End If
                    
                    If a < 50 Then
                      AddChat vbGray, "-- Bot Command: ", vbGreen, cmdwhoami & " " & cmdsay & " " & cmdjoin
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                      
                      sendPacket &H2, username & Chr$(0) & cmdwhoami & cmdsay & cmdjoin
                    End If
                    
                    If a < 100 Then
                      AddChat vbGray, "-- Bot Command: ", vbGreen, allcmds
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                      
                      sendPacket &H2, username & Chr$(0) & allcmds
                    End If
                      
                    If a < 999 Then
                      AddChat vbGray, "-- Bot Command: ", vbGreen, ownerofbot
                      frmStatus.txtMainWindowAddChat.Caption = frmStatus.txtMainWindowAddChat.Caption + 1
                      
                      sendPacket &H2, username & Chr$(0) & ownerofbot
                    End If
  End Select

End Sub

Public Sub AddQ(ByVal text As String)
  sendPacket &H2, username & Chr$(0) & text
End Sub

Public Sub DSP(ByVal origin As Integer, text As String, Optional user As String = "", Optional color As String = vbYellow)
  Select Case origin
    Case 1
      sendPacket &H2, username & Chr$(0) & text
    Case 3
      sendPacket &HE, username & Chr$(0) & user & Chr$(0) & text
  End Select
End Sub
